package com.program.cloudmanage.tripteam.service;

import com.program.cloudmanage.tripteam.domain.Car;
import com.program.cloudmanage.tripteam.persistence.CarMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarService {
     @Autowired
    private CarMapper carMapper;
     public CarService (){}
    public List<Car> showCars(){
        return carMapper.showCar();
    }
    public List<Car> searchCarByTeamId(String teamId){
         return carMapper.searchCarByTeamId(teamId);
    }
    public Car  searchCarByPersonId(String personId){
         return carMapper.searchCarByPersonId(personId);
    }
    public Car searchCar(String carid){
        return carMapper.searchCar(carid);
    }
    public void insertCar(Car car){
        carMapper.insertCar(car.getCarid(), car.getPersonid(), car.getType(),car.getDate(),car.getStyle(),car.getInformation(),car.getPlace(),car.getDirection(),car.getColor(),car.getTeamid());
    }
    public void deleteCar(String carid)
    {
        carMapper.deleteCar(carid);
    }
    public void updateCar(Car car){carMapper.updateCar(car.getCarid(),car.getPersonid(),car.getType(),car.getDate(),car.getStyle(),car.getInformation(),car.getPlace(),car.getDirection(),car.getColor());}

}
